In the win32file module, there is a getdiskfreespace function, which can be easily implemented. However, you must first download pywin32; otherwise, run the followingCodeWhen the message is: importerror: No module named win32file
In addition, it seems that the version must be later than python2.6.
Import win32file
Sectorspercluster, bytespersector, numfreeclus
anything, tell the SCM we are start
ing the stop process. Self. Reportservicestatus (Win32service.
service_stop_pending) # and set my event. Win32event.
SetEvent (self.hwaitstop) def svcdorun (self): #实际运行代码 # Copydvd2hard.copydvd2hard () Win32event. WaitForSingleObject (Self.hwaitstop, win32event. INFINITE) If __name__== ' __main__ ': Win32serviceutil. Handlecommandline (Smallestpythonservice)
copydvd2hard.py
__author__ = ' M '
import os
import
It is convenient to use Python to monitor file system changes under Windows. The example code is as follows, very simple, not much to say.Import Osimport Win32fileimport win32conactions = {1: "Created", 2: "Deleted", 3: "Updated", 4: "Renamed from som Ething ", 5:" Renamed to something "}file_list_directory = Win32con. Generic_read | Win32con. Generic_writepath_to_watch = "." Hdir = Win32file. CreateFile (Path_to_watch, File_list_directory, Win32con.
',R 'd: \ test \ file_test.py ']
For filename in filenames:Print '% 4d, % s' % (win32file. GetFileAttributesW (filename), filename)
Running result:
4. more intuitive judgment of hidden files with operations ()The sample code is as follows. the calculation result corresponds to the hidden property value, allowing you to more intuitively determine the file type.
The code is as follows:
Import win32fileImport win32con
Filenames = [r 'd: \ test ',R 'd
https://win32com.goermezer.de/content/view/286/285/This site is really a force, not much to say, the code directly to carry over, and my test results, take away!ImportOSImportSYSImportWin32fileImportwin32conactions= { 1:"Created", 2:"Deleted", 3:"Updated", 4:"Renamed from Something", 5:"Renamed to something"}file_list_directory= 0x0001Path_to_watch='e:/test'Print 'watching changes in', Path_to_watchhdir=Win32file. CreateFile (Path_to_watch, File_
Folder copy, retain the file modification time, sort by the latest modification time, copy modification time
import sys, os, time, shutil from stat import ST_ATIME, ST_CTIME, ST_MTIME from win32file import CopyFiledef test(self): remoteDir = "\\\\orc-fs\\Builds\\FP\\builds01\\flair\\Main" localDir = "d:\\Main" i = 0 for name in os.listdir(remoteDir): print name if i == 3: break shutil.copytree(os.pat
version: 1.0.0.6File flags: 0 (Mask 17)File OS: 4 Unknown Win32File type: 1.0 AppFile date: 00000000.00000000Translations: 0804.04b0ProductName:SysEnter ApplicationInternalName: SysEnterOriginalFilename: SysEnter.exeProductVersion: 1, 0, 0, 6FileVersion: 1, 0, 0, 6FileDescription: SysEnter ApplicationLegalCopyright: Copyright (C) 2011
Now that we know that the driver called PassGuard_x64.sys is the culprit, we should remove it and start loading. Ope
From ctypes import * import timeimport win32filerun = truelogfile = open ('. \ log. out', 'W + '); # open log fileinput = raw_input ("input a string for disk name like \ 'd: \' or other :") # input a disk namewhile run: sectorspercluster, bytespersector, numfreeclusters, totalnumclusters = \ win32file. getdiskfreespace (input) freespace = (numfreeclusters * sectorspercluster * bytespersector)/(1024*1024) # Get free spacelogfile. write ("% S % s freesp
Microsoft coder a clerical error!
0:kd> LMVM CDROMStart End Module Name8b7df000 8b7fe000 CDROM (pdb symbols) D:\SYMBOLSLOCAL\CDROM.PDB\45095501C39640C5BEEACE8E677232CC2\CDROM.PD BLoaded symbol Image File:cdrom.sysMapped memory image File:d:\symbolslocal\cdrom.sys\4a5bbf1c1f000\cdrom.sysImage Path: \systemroot\system32\drivers\cdrom.sysImage Name:cdrom.sysTimestamp:tue June 07:11:24 2009 (4A5BBF1C)checksum:00029646imagesize:0001f000File version:6.1.7600.16385Product version:6.1.7600.16385File f
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.